package me.jessyan.mvparms.demo.mvp.presenter.login;

import android.app.Application;

import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;

import me.jessyan.rxerrorhandler.core.RxErrorHandler;

import javax.inject.Inject;

import me.jessyan.mvparms.demo.mvp.contract.login.LoginAndRegsiterContract;


@ActivityScope
public class LoginAndRegsiterPresenter extends BasePresenter<LoginAndRegsiterContract.Model, LoginAndRegsiterContract.View> {
    @Inject
    RxErrorHandler mErrorHandler;
    @Inject
    Application mApplication;
    @Inject
    ImageLoader mImageLoader;
    @Inject
    AppManager mAppManager;

    public enum PageStatus{
        PASSWORD,REGISTER,VERIFY
    }

    /**
     * 当前页面状态
     */
    PageStatus mCurrentStatus= PageStatus.VERIFY;


    /**
     * 该表当前的页面状态
     */
    public void ChangeCurrentStatus(PageStatus mCurrentStatus) {
        this.mCurrentStatus = mCurrentStatus;
        switch (mCurrentStatus){
            case PASSWORD:
                mRootView.changePassWord();
                break;
            case VERIFY:
                mRootView.changeVerify();
                break;
            case REGISTER:
                mRootView.changeRegister();
                break;
                default:
        }
    }

    public PageStatus getmCurrentStatus() {
        return mCurrentStatus;
    }

    @Inject
    public LoginAndRegsiterPresenter(LoginAndRegsiterContract.Model model, LoginAndRegsiterContract.View rootView) {
        super(model, rootView);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mErrorHandler = null;
        this.mAppManager = null;
        this.mImageLoader = null;
        this.mApplication = null;
    }
}
